package com.lanxin.oa.zc.controller;

import com.lanxin.bean.ZcAssettype;
import com.lanxin.oa.zc.service.ZcTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("zctype")
public class ZcTypeControlller {

    @Autowired
    private ZcTypeService zctype;
    @RequestMapping("select")
    public ModelAndView selectzctype(HttpServletRequest request, String typeMethod, Integer type) {
        List<ZcAssettype> list = zctype.selectzctype();
        request.getSession().setAttribute("list",list);;
        ModelAndView mo=new ModelAndView();
        mo.setViewName("../view/zc/zctypelist.jsp");
        return mo;
    }
    @RequestMapping("add")
    public ModelAndView addzctype( ZcAssettype type) {
        zctype.addzctype(type);
        ModelAndView mo=new ModelAndView();
        mo.setViewName("redirect:select");
        return mo;
    }
    @RequestMapping("update")
    public ModelAndView updatezctype(String status,Integer oid ) {
        zctype.updatezctype(oid,status);
        ModelAndView mo=new ModelAndView();
        mo.setViewName("redirect:select");
        return mo;
    }
    @RequestMapping("delete")
    public ModelAndView deletezctype(Integer oid ) {
        zctype.deletezctype(oid);
        ModelAndView mo=new ModelAndView();
        mo.setViewName("redirect:select");
        return mo;

    }



}
